#===============================================================================
# Koro Business Environment
# Copyright (C) 2008  Antonio Corroppoli
#
#This file is part of Koro BE.
# 
# Koro BE is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# Koro BE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Koro BE; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#===============================================================================
print 'importo interfaces'
#contiene le interfacce Observer e Observable per l'implementazione del pattern Observer.


class Observer(object):
    def __init__(self):
        pass
    
    def update(self):
        pass


class Observable:
    def __init__(self):
        self.__observer=None

    def attach(self,observer):
        assert isinstance(observer,Observer)
        self.__observer = observer

    def detach(self):
        self.__observer=None

    def get_observer(self):
        return self.__observer
    
    def notify(self):
        self.__observer.update()

    
        
